<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
    <head>
        <title>美业红</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1">
        <link href="http://cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
        <link href="/public/css/main.css" rel="stylesheet">
        <script type='text/javascript' src='/public/js/jquery-3.1.1.min.js'></script>
        <script type="text/javascript" src='/public/js/jquery.validate.js'></script>
        <script type="text/javascript" src='/public/js/main/main.js'></script>
        <script>
            var _hmt = _hmt || [];
            (function () {
                var hm = document.createElement("script");
                hm.src = "//hm.baidu.com/hm.js?8d43b5b5d798921b66d689f7a792e6e2";
                var s = document.getElementsByTagName("script")[0];
                s.parentNode.insertBefore(hm, s);
            })();
        </script>
        <script type="text/javascript">
            document.domain = '<?php echo _DOMAIN_ALL_;?>';
        </script>
        <link rel="shortcut icon" type="image/ico" href="/favicon.ico">
    </head>
    <body style="background-color: #f4f4f4;">
        <div class="navigation">
            <div class='navlogo'>
            <a href='/'><img class='_navlogo' src="/public/images/logo.png"></a>
            </div>
            <div class='navson'>
                <ul class='fr'>
                <li><a href='/' class='anchor'><b>主页</b></a></li>
                <li><a href="/home/store" class='anchor'><b>店铺</b></a></li>
                <li><a href="/home/barber" class='anchor'><b>成员</b></a></li>
                <li><a href="/home/action" class='anchor'><b>活动</b></a></li>
                <li><a href="/home/order" class='anchor'><b>订单</b></a></li>
                <li><a href="/home/coupon" class='anchor'><b>优惠券</b></a></li>
                <li><a href="/home/goods" class='anchor'><b>商品</b></a></li>
                </ul>
           </div>
            <?php if($_SESSION['id']>0){?>
            <div style="float:right;padding-right:10%">你好:<span id='login_name'></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class='anchor' href='/home/passport/repassword'>修改密码</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class='anchor' href='/home/passport/logout'>退出</a></div>
            <?php }?>
        </div>
        <div style='margin-top:80px;width:100%'>
            <img class='_navlogo' src="/public/images/contentlogo.png" style='width:100%;height:100px'>
        </div>
        <div class='container'>
            <div class='_main'>
            <div class='_line'></div> 
<div class="_contro">
    <a href="/home/goods/create?id=<?php echo $item['id'];?>&store_id=<?php echo $item['store_id']?>&copy=1" class="_a"><font style='font-size:1.5rem'>复制商品</font></a>
    <a href="/home/goods/" class="_a"><font style='font-size:1.5rem'>返回列表页</font></a>
</div>
<div class='_cut'></div>
<div class='content'>
<form action='/home/goods/submit' method='post'  id='form'>
    <div>
        <div class="form-group row">
            <label for="exampleInputName2" class="_label" >店铺:</label>
            <input id="store_id" name="store_id" type='text' readonly="readonly"  value='<?php echo $store['name'];?>' > 
               
        </div>
    </div>
    <div>
        <div class="form-group row">
            <label for="exampleInputName2" class="_label" >商品名称:</label>
            <input type="text" class="row _minput" name='name' readonly="readonly" placeholder="" value="<?php echo $item['name'];?>"/>
        </div>
    </div>
    <div>
        <div class="form-group row">
            <label for="exampleInputName2" class="_label" >商品小标题:</label>
            <input type="text" class="row _minput" name='title' readonly="readonly" placeholder="" value="<?php echo $item['title'];?>"/>
        </div>
    </div>
    <div>
        <div class="form-group row">
            <label for="exampleInputName2" class="_label" >商品种类:</label>
            <input id="type" name="type" class="_select valid" value="<?php if($item['type'] == 0){ echo '剪发类';}elseif($item['type'] == 1){ echo '烫染类';}elseif($item['type'] == 2){ echo '护理类';}elseif($item['type'] == 3){ echo '仪器类';}elseif($item['type'] == 4){ echo '人工类';}?>" >
               
        </div>
    </div>
    <div>
        <div class="form-group row">
            <label for="exampleInputName2" class="_label" >商品类型:</label>
            <input id="type_meal" name="is_meal_set" value="<?php if($item['is_meal_set'] == 0){ echo '单品';}elseif($item['is_meal_set'] == 1){echo '套餐';}?> " >
               
        </div>
    </div>
    <!--下面的div 当是套餐是显示-->
    <div id='meal' style='display:none' >
        <div>
            <div class="form-group row">
                <label for="exampleInputName2" class="_label" >商品:</label>
                <select id="meal_set2" name="meal_set[]" class="_select valid">

                </select>
                &nbsp;&nbsp;&nbsp;&nbsp;
                数量：<input type="text" name="num[]"  id='num2' style="width:5rem;">
            </div>
        </div>
        <div>
            <div class="form-group row">
                <label for="exampleInputName2" class="_label" >&nbsp;&nbsp;&nbsp;&nbsp;</label>
                <select id="meal_set1" name="meal_set[]"  class="_select valid">

                </select>
                &nbsp;&nbsp;&nbsp;&nbsp;
                数量：<input type="text" name="num[]" id='num1' style="width:5rem;">
            </div>
        </div>
        <div>
            <div class="form-group row">
                <label for="exampleInputName2" class="_label" >&nbsp;&nbsp;&nbsp;&nbsp;</label>
                <select id="meal_set0" name="meal_set[]" class="_select valid">

                </select>
                &nbsp;&nbsp;&nbsp;&nbsp;
                数量：<input type="text" name="num[]" id='num0' style="width:5rem;">
            </div>
        </div> 
    </div>
    <div>
        <div class="form-group row">
            <label for="exampleInputName2" class="_label" >商品价格:</label>
            <input type="text"  name='price' placeholder="" value="<?php echo ($item['price']/100);?>" style='width:5%' readonly="readonly" >&nbsp;元
        </div>
    </div>
    <div>
        <div class="form-group row">
            <label for="exampleInputName2" class="_label" >商品成员:</label>
            <?php $members = json_decode($item['level']); if($members){ ?>
            <input name="member" type="radio" value="0"  <?php if(in_array(0,$members)){ echo 'checked ';} ?> >全部成员&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
            <input name="member" type="radio" value="1"  <?php if(!in_array(0,$members)){ echo 'checked ';} ?> />指定成员
            <?php }else{?>
            <input name="member" type="radio" value="0"  checked >全部成员&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
            <input name="member" type="radio" value="1"   />指定成员
            <?php } ?>
        </div>
        <div id='members' style='display:none' >
            <label for="exampleInputName2" class="_label" ></label>
            <label><input name="members[]" type="checkbox" value="6" <?php if(in_array(6,$members)){ echo 'checked="checked" ';} ?> />&nbsp;高级助理 </label>&nbsp;&nbsp;
            <label><input name="members[]" type="checkbox" value="1" <?php if(in_array(1,$members)){ echo 'checked="checked" ';} ?> />&nbsp;高级发型师 </label>&nbsp;&nbsp;
            <label><input name="members[]" type="checkbox" value="2" <?php if(in_array(2,$members)){ echo 'checked="checked" ';} ?> />&nbsp;高级总监 </label>&nbsp;&nbsp;
            <div>
            <label for="exampleInputName2" class="_label" ></label>
            <label><input name="members[]" type="checkbox" value="3" <?php if(in_array(3,$members)){ echo 'checked="checked" ';} ?> />&nbsp;高级顾问 </label>&nbsp;&nbsp;
            <label><input name="members[]" type="checkbox" value="4" <?php if(in_array(4,$members)){ echo 'checked="checked" ';} ?> />&nbsp;高级美容师 </label>&nbsp;&nbsp;
            <label><input name="members[]" type="checkbox" value="5" <?php if(in_array(5,$members)){ echo 'checked="checked" ';} ?> />&nbsp;高级经理 </label>&nbsp;&nbsp;
            </div>
        </div>
    </div>
    <div>
        <div class='form-group row'>
                <label for="exampleInputName2" class="_label">商品图:</label>
                <?php if($item['id']>0){ foreach($item['images'] as $k=>$v){ ?>
                <img src="<?php echo 'http://'.IMAGE_DOMAIN.$item['images'][$k]['image'];?>" style="width:15rem;height: 15rem;border:1px;border-color: black" id="_banner_"/>
                <?php } }else{?>
                <img src="<?php echo 'http://'.IMAGE_DOMAIN.'/upload/product.png';?>" style="width:20rem;height:20rem;border:1px;border-color: black" id="_banner_"/>
                <?php }?>
       </div>
    </div>
        <div class='form-group row'>
            <div><label for="exampleInputName2" class="_label">商品介绍:</label></div>
                <label for="exampleInputName2" class="_label"></label>
                <textarea name='intro' id="_intro" class="_textarea" style="width:40%" readonly="readonly" ><?php echo $item['intro']; ?></textarea>
        </div>
        <div class="form-group _submit_div row">
                <input name='id' type='hidden' value="<?php echo $item['id'];?>"/>
                <input name='item_number' type='hidden' value="<?php echo $item['item_number'];?>"/>
        </div>
</form>

</div>
<script type="text/javascript">
    $(document).ready(function () {  
        type_meal = "<?php echo $item['is_meal_set']; ?>" ;
        if(type_meal==1){  
            $('#meal').show();
            store_id = "<?php echo $item['store_id']; ?>";
            item_number = "<?php echo $item['item_number'] ?>";
            var id = "<?php echo $item['id'] ?>";   
            $.ajax({
                url:"/home/goods/getMealSetByMember?store_id="+store_id+"&item_number="+item_number+"&id="+id,
                async: true,
                success: function (data) {
                    if(data=='false'){
                        return;
                    }
                    data = eval('(' + data + ')');
                    $.each(data, function (i, v) {
                        var str = "<option value='"+v.id+"' checked >"+v.name+"</option>";
                        $('#num'+i).val(v.number);
                        $('#meal_set'+i).html(str);
                    });
                }
            });
        }
        if($('input:radio[name="member"]:checked').val()==1){
            $('#members').show();
        }

        
    });

    

</script>
</div>
</div>
<div class='_line'></div>
<div class="newfooter">
    ©2015-2017 All Rights Reserved ( 京ICP备15010043号 ) 
</div>
<div id='mask_layer' style="text-align: center;width:100%;height:100%;overflow:hidden;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#8E8E8E',endColorstr='##8E8E8E');
     background-color:rgba(255, 255, 255, 0.4);position:fixed; _position:absolute; top:0;left:0; z-index:5000;display:none ">
    <div style="padding-top: 20%"><h1><b>loading<span id="_loading"></span></b></h1></div>
</div>
</body>
<script type="text/javascript" src='/public/js/top.js'></script>
</html>